package com.amazon.service;


import com.amazon.bo.KeyWords;
import com.amazon.dao.KeyWordsDao;
import com.amazon.web.util.Send253SMS;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("keyWordsService")
public class KeyWordsService {
    @Resource
    private KeyWordsDao keyWordsDao;
    @Resource
    private SMSCodeService smsCodeService;
    @Resource
    private Send253SMS send253SMS;
    @Resource
    I18nService i18nService;

    //保存
    public boolean save(KeyWords k){
        return keyWordsDao.save(k);
    }

    public KeyWords getKeyWordsByCh(String k){
        return keyWordsDao.getKeyWordsByCh(k);
    }

    public boolean update(KeyWords k){
        return keyWordsDao.updateKey(k);
    }
    //关键词列表
    public List<KeyWords> getKeyWordsList(final int page, final int pageSize){
        return keyWordsDao.getKeyWordsList(page,pageSize);
    }
    //记录数
    public int getKeyWordsCount(){
        return keyWordsDao.getTotalCount(KeyWords.class,"");
    }

    public KeyWords getKeyWordsById(int id){
        return keyWordsDao.getById(Long.parseLong(Integer.toString(id)));
    }
    //关键字删除
    public void keyWordsDelete(KeyWords k){
        keyWordsDao.delete(k);
    }

}
